var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');

module.exports = webpackMerge(commonConfig, {
    // devtool: 'cheap-module-eval-source-map', 
    devtool: 'eval',

    output: {
        path: helpers.root('dist'),
        publicPath: '/',
        filename: '[name].js',
        chunkFilename: '[id].chunk.js'
    },

    plugins: [
        // new ExtractTextPlugin('[name].css'),
        // 开启热加载插件（HMR）
        new webpack.HotModuleReplacementPlugin()
    ],

    devServer: {
        // contentBase: "./dist", //本地服务器所加载的页面所在的目录
        historyApiFallback: true, //不跳转
        stats: 'minimal',
        hot: true,
        inline: true, //实时刷新
        port: 9090, // 修改端口，一般默认是8080
        proxy: {
            "/api": {
                target: "http://localhost:8080",
                pathRewrite: { "^/api": "" }
            }
        },
    }
});